package com.itheima.mMothodDemo;

import java.util.Scanner;

/*
     查找索引
 */
public class Work05 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = {19, 28, 37, 46, 50};
        int num = sc.nextInt();
        index(arr, num);
    }

    public static void index(int[] arr, int num) {
        int index = -1;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num) {
                index = i;
            }
        }
        if (index < 0) {
            System.out.println("输入有误");
        } else {
            System.out.println("索引值为:" + index);
        }
    }
}
